Purpose: Inheritance
Points: 25
My Inherited String
Assignment
Create a class named MyString that inherits from the c++ string class.
Add the following
public functions:
public:
MyString(int i);
// a conversion constructor
MyString(const string& s); // a
conversion constructor
void
trimStart(); //removes all leading white space
void
trimEnd(); //removes
all trailing white space
void
trim(); //removes both leading and trailing white space
void
toUpper(); //makes all characters uppercase
void toLower();//makes
all characters lowercase
//make
the string the specified size by adding the filler
//character
to the end repeatedly until it is the correct length
void padRight(int Size, char Filler);
//make
the string the specified size by adding the filler
//character
to the beginning repeatedly until it is the correct
//length
void padLeft(int Size, char Filler);
//return
true if the string starts with the string passed in
bool startsWith(const MyString&
s) const;
//return
true if the string ends with the string passed in
bool endsWith(const MyString&
s) const;
//make
the string contain its current contents the specified
//number
of times
MyString& operator*=(int TimesToRepeat);
//assign the string
parameter to the current string
const MyString&
operator=(const MyString& rValue);
//check to see if the contents of the string is a valid number
//it may contain one decimal
point
bool isNumeric()const;